#ifndef _UTIL_H_
#define _UTIL_H_

#include "global.h"
#include "table.h"
#include "midcode.h"

extern Bool isTYPE_DECL(TokenType tt);                   // Decide if tt is a TYPE_DECL.
extern Bool isADDITIVE_OP(TokenType tt);                 // Decide if tt is PLUS or MINUS.
extern Bool isMULTIPLI_OP(TokenType tt);                 // Decide if tt is TIMES or SLASH
extern Bool isRELATION_OP(TokenType tt);                 // Decide if tt is a relation operation code.

Bool token_type_match(TokenType ta, TokenType tb);       // Decide if constant type and type declaration is matched.
extern Value str_to_value(TokenType tt, char *tb);       // Convert string to binary number.
//extern Type get_type(TokenType tt);                    // Deprecated.

extern Bool is_global_normal_element(Class clss);        // Decide if clss if a global Class.
extern Bool is_constant(Class clss);                     // Decide if clss is a constant Class.
extern Opcode tt2oc(TokenType tt);                       // Map TokenType to Opcode.
extern Type tt2tp(TokenType tt);                         // Map TokenType to Type
extern Bool isJumpOp(Opcode oc);                         // Decide if oc is a jump operation code
extern Bool isAriOp(Opcode oc);                          // Decide if oc is a arithmetic operation code.
extern Bool isIfOp(Opcode oc);                           // Decide if oc is relation regarding operation code.

#endif
